package com.han.gift.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:Han
 * @Date :2023/2/25 21:16
 * @Description:
 */
@Configuration
public class JacksonConfig {
    final ObjectMapper objectMapper = new ObjectMapper();
    @Bean
    public ObjectMapper jacksonMapper(){
        SimpleModule simpleModule = new SimpleModule();
        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
        objectMapper.registerModule(simpleModule);
        return objectMapper;
    }
}
